package dao.impl;

import dao.IEmpDao;
import pojo.Emp;
import util.DBHelper;

import java.util.ArrayList;

public class EmpDaoImpl implements IEmpDao {

    private DBHelper db=new DBHelper();
    @Override
    public ArrayList<Emp> selectByEmpnoAndEname(Emp emp) {
        String sql = "select * from emp where empno=? and ename=?";
        Object[] objs={emp.getEmpno(),emp.getEname()};
        return db.dtQuery(sql,Emp.class,objs);
    }

    @Override
    public ArrayList<Emp> selectAll() {
        String sql="select * from emp";
        return db.dtQuery(sql,Emp.class);
    }

    @Override
    public int delByEmpno(int empno) {
        String sql="delete from emp where empno=?";
        return db.dtUpdate(sql,empno);
    }
}
